//
//  TrainingOrderViewController.m
//  Edumap
//
//  Created by 辰领科技 on 16/7/22.
//  Copyright © 2016年 yuf. All rights reserved.
//

#import "TrainingOrderViewController.h"
#import "TutorChoiceViewController.h"

@interface TrainingOrderViewController ()
@property (strong, nonatomic) IBOutlet UIView *navView;
@property (strong, nonatomic) IBOutlet UIScrollView *scroview;
@property (strong, nonatomic) IBOutlet UIView *topView;
@property (strong, nonatomic) IBOutlet UILabel *nameLabel;
@property (strong, nonatomic) IBOutlet UILabel *phoneNumberLabel;
@property (strong, nonatomic) IBOutlet UILabel *addressLabel;

@property (strong, nonatomic) IBOutlet UIView *bottomView;
@property (strong, nonatomic) IBOutlet UIImageView *image;
@property (strong, nonatomic) IBOutlet UILabel *titleLabel;
@property (strong, nonatomic) IBOutlet UILabel *moneyLabel;
@property (strong, nonatomic) IBOutlet UILabel *timesLabel;
@property (strong, nonatomic) IBOutlet UILabel *subjectsLabel;
@property (strong, nonatomic) IBOutlet UITextField *noteTextField;
@property (strong, nonatomic) IBOutlet UILabel *totalAmountLabel;

@end

@implementation TrainingOrderViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self initViewLayout];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
}

- (void)initViewLayout{
    [self adaptiveViewLayout:self.view];
    [self adaptiveViewLayout:self.navView];
    [self adaptiveViewLayout:self.topView];
    [self adaptiveViewLayout:self.bottomView];
    [self adaptiveViewLayout:self.scroview];
    _scroview.contentSize = flexibleSize(CGSizeMake(0, 455), NO);
    
    self.noteTextField.layer.masksToBounds = YES;
    self.noteTextField.layer.cornerRadius = 5*VerticalRatio();
    self.noteTextField.layer.borderColor = [UIColor colorWithWhite:0.914 alpha:1.000].CGColor;
    self.noteTextField.layer.borderWidth = 1;
    
    if (_isHaveAContact) {
        
        _topView.hidden = NO;
        _bottomView.frame = flexibleFrame(CGRectMake(0, 115, 320, 285),NO);
        
    } else if (!_isHaveAContact) {
        
        _topView.hidden = YES;
        _bottomView.frame = flexibleFrame(CGRectMake(0, 44, 320, 285),NO);
        
    }
    
}

- (IBAction)back:(id)sender {
    [self backBtn];
}

#pragma mark - 添加联系人
- (IBAction)add:(UIButton *)sender {
    UIStoryboard *secondStroyBoard=[UIStoryboard storyboardWithName:@"TeachStoryboard" bundle:nil];
    TutorChoiceViewController *page = [secondStroyBoard instantiateViewControllerWithIdentifier:@"TutorChoice"];
    [[Common getNavigation] pushViewController:page];
    
    __weak typeof(self) weakSelf = self;
    page.TutorChoiceBlock = ^(BOOL isHaveAContact) {
        weakSelf.isHaveAContact = isHaveAContact;
    };
}

#pragma mark - 联系人
- (IBAction)contact:(UIButton *)sender {
    UIStoryboard *secondStroyBoard=[UIStoryboard storyboardWithName:@"TeachStoryboard" bundle:nil];
    TutorChoiceViewController *page = [secondStroyBoard instantiateViewControllerWithIdentifier:@"TutorChoice"];
    
    __weak typeof(self) weakSelf = self;
    page.TutorChoiceBlock = ^(BOOL isHaveAContact) {
        weakSelf.isHaveAContact = isHaveAContact;
    };
    [[Common getNavigation] pushViewController:page];
}

#pragma mark - 立即支付
- (IBAction)pay:(id)sender {
}

@end
